import { FMVCS } from "../../fgui/fmvc/FMVCS";
import Manager from "../../manager/Manager";
import LevelChooseView from "./LevelChooseView";
import { ConstDefine } from "../common/ConstDefine";
import { GlobalEvent } from "../global/Global";
import LevelChooseData from "./LevelChooseData";

export default class LevelChooseCtrl extends FMVCS.FCtrl {
    /** 数据实体 */
    static data: LevelChooseData = null;

    constructor() {
        super();
        LevelChooseCtrl.data = new LevelChooseData();
    }

    /** 事件监听注册 */
    rigisterEventListener(){
        this.on(GlobalEvent.UIListenID.UI_BtnStart_Click, this.openView, this);
        this.on(GlobalEvent.UIListenID.UI_LevelChooseView_Open, this.openView, this);
        this.on(GlobalEvent.UIListenID.UI_LevelChoose, this.closeView, this);
    }

    openView(){
        Manager.fui.open(ConstDefine.UI.LevelChoose, LevelChooseView);
    }

    closeView(){
        Manager.fui.close(ConstDefine.UI.LevelChoose);
    }
}
